package com.woniuxy.controller;

import com.woniuxy.entity.Images;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.ImagesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Leimin
 * @date 2022/05/10 09:14
 **/
@RestController
@Api(tags = "图片管理接口")
@RequestMapping("/images")
public class ImagesController {
    @Autowired
    private ImagesService imagesService;

    @PostMapping(value = "/images")
    @ApiOperation("新增")
    public ResponseEntity addOne(@ApiParam(name = "images", value="图片")@RequestBody Images images)  {
        return imagesService.addOne(images);
    }

    @DeleteMapping(value = "/images/{id}")
    @ApiOperation("删除")
    public ResponseEntity deleteOne(@ApiParam(name = "id", value="图片id")@PathVariable int id)  {
        return imagesService.deleteOne(id);
    }
}


